package vg.com.chatonline.adapter;

import java.util.ArrayList;

import vg.com.chatonline.activity.R;
import vg.com.classdata.chat;
import vg.com.frame.yahoo_frame;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class adapter_chat extends BaseAdapter{
	Context contex;
	ArrayList<chat> mItems;
	LayoutInflater inflate = null;
	
	public adapter_chat(Context context,ArrayList<chat> items)
	{
		this.contex = context;
	     this.mItems = items;
	     inflate = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}
	
	public int getCount() {
		// TODO Auto-generated method stub
		return mItems.size();
	}

	public chat getItem(int position) {
		// TODO Auto-generated method stub
		return mItems.get(position);
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if (convertView == null) {
			convertView = inflate.inflate(R.layout.item_yahoo, null);
		}
		yahoo_frame post=(yahoo_frame)convertView.findViewById(R.id.frame_yh);
		post.fillData(mItems.get(position).getTime(),mItems.get(position).getUrl_img(), mItems.get(position).getChattext());
		return convertView;
	}

}
